package com.example.aquanliangblogscan.controller;

import com.example.aquanliangblogscan.service.ScanBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guochaobin
 * @date 2022/9/7
 */
@RestController
public class HelloController {
    @Autowired
    ScanBlogService scanBlogService;

    @GetMapping("start")
    public String scanBlogs(@RequestParam(value = "savePath", required = false) String savePath) {
        if (StringUtils.isEmpty(savePath)) {
            savePath = "D:\\blogs.xls";
        }
        scanBlogService.getDataToExcel(savePath);
        return "success! excel文件存放在" + savePath;
    }
}
